/**
    ATClab - scriptable Air Traffic Control simulations.
    Copyright (C) 2010 openatclab@gmail.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
**/

#ifndef __DISPLAY_TASK_HDR__
#define __DISPLAY_TASK_HDR__


#include "task.h"
#include <qlabel.h>
//Added by qt3to4:
#include <QShowEvent>
#include <Q3Frame>
#include <Q3BoxLayout>


class Q3BoxLayout;
class Q3Frame;
class QTimer;


namespace pact {

	class DisplayTaskBuilder;

	/*!
	 *
	 */
	class DisplayTask : public Task {
		Q_OBJECT
		friend class DisplayTaskBuilder;
	private:
		DisplayTask( DisplayTaskBuilder * );
	public:
		~DisplayTask();
	public:
		void showEvent( QShowEvent * );
	signals:
		void sig_shown();
	};


	/*!
	 *
	 */
	class CountDown : public QLabel {
		Q_OBJECT
	private:
		static const QString FORMAT_TEXT;
	public:
		CountDown( long, QWidget * );
		~CountDown();
	public slots:
		void start();
		void update_time();
	signals:
		void sig_timeout();
	private:
		void update_display();
	private:
		QTimer	*_timer;
		long	 _secs;
	};


	/*!
	 *
	 */
	class DisplayTaskBuilder : public xml::DocumentView {
		friend class DisplayTask;
	public:
		DisplayTaskBuilder();
		~DisplayTaskBuilder();
	public:
		DisplayTaskBuilder* set_text( const std::string  & );
		DisplayTaskBuilder* set_link( const std::string  & );
		DisplayTaskBuilder* set_countdown( int );
	public:
		DisplayTask* build();
	private:
		Q3Frame		*_widget;
		Q3BoxLayout	*_layout;
	};

};


#endif
